<template>
  <div class="proper-manage-com-baseinfo">
    <sec-descriptions
      :data="formConfig.data"
      :colon="true"
      :labelStyle="{ width: '100px', 'text-align': 'right', 'line-height': '36px' }"
      :contentStyle="{ 'line-height': '36px' }"
      :column="3"
      :border="false"
      :keyData="formConfig.baseInfo"
      title="基础信息"
    >
      <template v-slot:gitList>
        <el-tag v-for="(item, index) in formConfig.data.gitList" style="margin: 0 5px 5px 0" :key="index">{{
            item
          }}</el-tag>
      </template>
    </sec-descriptions>
    <sec-descriptions
      :data="formConfig.data"
      :colon="true"
      :labelStyle="{ width: '100px', 'text-align': 'right', 'line-height': '36px' }"
      :contentStyle="{ 'line-height': '36px' }"
      :column="3"
      :border="false"
      :keyData="formConfig.per"
      title="权属信息"
    >
    </sec-descriptions>
    <sec-descriptions
      :data="formConfig.data"
      :colon="true"
      :labelStyle="{ width: '100px', 'text-align': 'right', 'line-height': '36px' }"
      :contentStyle="{ 'line-height': '36px' }"
      :column="3"
      :border="false"
      :keyData="formConfig.risk"
      title="风险信息"
    >
    </sec-descriptions>
  </div>
</template>

<script>
import secDescriptions from "components/descriptions/myDescriptions";
export default {
  name: "baseInfo",
  props: {
    formData: {
      type: Object,
      default: () => {
        return {};
      },
    },
  },
  watch: {
    formData: {
      deep: true,
      immediate: true,
      handler(newVal) {
        this.formConfig.data = newVal;
      },
    },
  },
  data() {
    return {
      formConfig: {
        data: {},
        baseInfo: [
          {
            label: "资产来源",
            prop: "source",
            formatter: (data) => {
              return this.utils.getDicLabel("100100", data.source);
            },
          },
          { label: "资产ID", prop: "id" },
          { label: "appID", prop: "assetCode" },
          { label: "域名", prop: "domain" },
          { label: "系统名称", prop: "assetName" },
          {
            label: "资产状态",
            prop: "status",
            formatter: (data) => {
              return this.utils.getDicLabel(100500, data.status);
            },
          },
          { label: "接入环境", prop: "scanDev" },
          { type: "slot", label: "git地址", prop: "gitList", span: 24 },
          { label: "备注", prop: "remark1", span: 24 },
        ],
        per: [
          { label: "权属负责人", prop: "leader" },
          { label: "权属部门", prop: "dept2", span: 24 },
          {
            label: "项目关注人",
            prop: "noticeUsers",
            formatter: (data) => {
              let noticeUsers = data.noticeUsers;
              if (Array.isArray(noticeUsers)) {
                return noticeUsers.map((e) => e.account).join(",");
              }
              return noticeUsers;
              // return this.utils.getDicLabel(101004, data.required);
            },
          }
        ],
        risk: [
          { label: "待处理风险", prop: "riskNum" },
          { label: "已处理风险", prop: "riskDoneNum", span: 24 },
          { label: "达标情况", prop: "compliance" },
          { label: "信用分", prop: "creditScore" },
        ]
      }
    }
  },
  components: {
    secDescriptions
  }
}
</script>

<style scoped lang="scss">
.proper-manage-com-baseinfo {
  .el-form-item__label {
    font-size: 14px;
  }
}
</style>
